K5

public final class K5

Functions

getAlwaysOnTop
Link copied to clipboard
final Boolean getAlwaysOnTop()
getDimensFloat
Link copied to clipboard
final Size getDimensFloat()

Use this property to get the actual k5 Playground size in Floats. Subtracting the 56f - which is the toolbar height of the window. When the size of the window is set with size param in k5 builder, it's applied to window and when the canvas is rendered in the window with Modifier.fillMaxSize it takes whole window except the toolbar.

getDimensInt
Link copied to clipboard
final IntSize getDimensInt()

Use this property to get the actual k5 Playground size in Ints

getEnabled
Link copied to clipboard
final Boolean getEnabled()
getFocusable
Link copied to clipboard
final Boolean getFocusable()
getIcon
Link copied to clipboard
final Painter getIcon()
getOnKeyEvent
Link copied to clipboard
final Function1<KeyEvent, BooleangetOnKeyEvent()
getOnPreviewKeyEvent
Link copied to clipboard
final Function1<KeyEvent, BooleangetOnPreviewKeyEvent()
getResizable
Link copied to clipboard
final Boolean getResizable()
getSize
Link copied to clipboard
final Size getSize()
getTitle
Link copied to clipboard
final String getTitle()
getUndecorated
Link copied to clipboard
final Boolean getUndecorated()
noLoop
Link copied to clipboard
final Unit noLoop()

Call method to stop the looping of canvas You can also call it to freeze the time frame for a canvas

show
Link copied to clipboard
final Unit show(Modifier modifier, Function1<DrawScope, Unit> sketch)

Shows the canvas window and renders it for each frame repetitively. Internally, this starts the Jetpack Compose Window and renders the sketch requested by user into the Jetpack Compose Canvas Composable. The size of the Canvas will be same as the size passed in k5 method by default. One can change the canvas size and window size with the help of modifiers. In order to keep the animation running (rendering canvas continuously), it requests to run the frame of animation in nanos. All the modifier will be applied to the Canvas.

showWithControls
Link copied to clipboard
final Unit showWithControls(Modifier modifier, Function0<Unit> controls, Function1<DrawScope, Unit> sketch)

Shows canvas window as well as controls view side by side. Internally, this starts the Jetpack Compose Window and renders the sketch requested by user into the Jetpack Compose Canvas Composable. The size of the Canvas will be same as the size passed in k5 method by default. One can change the canvas size and window size with the help of modifiers. In order to keep the animation running (rendering canvas continuously), it requests to run the frame of animation in nanos.

Properties

alwaysOnTop
Link copied to clipboard
private final Boolean alwaysOnTop
dimensFloat
Link copied to clipboard
private final Size dimensFloat

Use this property to get the actual k5 Playground size in Floats. Subtracting the 56f - which is the toolbar height of the window. When the size of the window is set with size param in k5 builder, it's applied to window and when the canvas is rendered in the window with Modifier.fillMaxSize it takes whole window except the toolbar.

dimensInt
Link copied to clipboard
private final IntSize dimensInt

Use this property to get the actual k5 Playground size in Ints

enabled
Link copied to clipboard
private final Boolean enabled
focusable
Link copied to clipboard
private final Boolean focusable
icon
Link copied to clipboard
private final Painter icon
onKeyEvent
Link copied to clipboard
private final Function1<KeyEvent, BooleanonKeyEvent
onPreviewKeyEvent
Link copied to clipboard
private final Function1<KeyEvent, BooleanonPreviewKeyEvent
resizable
Link copied to clipboard
private final Boolean resizable
size
Link copied to clipboard
private final Size size
title
Link copied to clipboard
private final String title
undecorated
Link copied to clipboard
private final Boolean undecorated